590 GET (1,1)-(159,198),BEFPLEFT% : GET (160,1)-(318,198),BEFPRIGHT%
600 BEFCOLOR = POINT(XX,YY)
610 CMD$=INKEY$:IF CMD$="" THEN POKE 23,(PEEK(23) AND 223):GOTO 610
620 IF MID$(CMD$,2,1) = "K" THEN XX=XX-1:GOTO 1010
630 IF MID$(CMD$,2,1) = "M" THEN XX=XX+1:GOTO 1010
640 IF MID$(CMD$,2,1) = "s" THEN XX=XX-5:GOTO 1010
650 IF MID$(CMD$,2,1) = "t" THEN XX=XX+5:GOTO 1010
660 IF MID$(CMD$,2,1) = "P" THEN YY=YY+1:GOTO 1010
670 IF MID$(CMD$,2,1) = "H" THEN YY=YY-1:GOTO 1010
680 IF MID$(CMD$,2,1) = "u" THEN YY=YY+5:GOTO 1010
690 IF MID$(CMD$,2,1) = "w" THEN YY=YY-5:GOTO 1010
700 IF MID$(CMD$,2,1) = "G" THEN YY=YY-1:XX=XX-1:GOTO 1010
710 IF MID$(CMD$,2,1) = "O" THEN YY=YY+1:XX=XX-1:GOTO 1010
720 IF MID$(CMD$,2,1) = "I" THEN YY=YY-1:XX=XX+1:GOTO 1010
730 IF MID$(CMD$,2,1) = "Q" THEN YY=YY+1:XX=XX+1:GOTO 1010
740 IF TEXTMODEFLAG THEN 3140
750 ' IF COMMAND ENTERED IS SMALL CASE MAKE IT LARGE.
760 IF ASC(CMD$)>96 AND ASC(CMD$)<123 THEN CMD$=CHR$(ASC(CMD$)-32)
770 IF CMD$ = "-" THEN PALETTE=0:COLOR BACKCOLOR,PALETTE
780 IF CMD$ = "=" THEN PALETTE=1:COLOR BACKCOLOR,PALETTE
790 IF CMD$ = "0" THEN CUSCOL = 0
800 IF CMD$ = "1" THEN CUSCOL = 1
810 IF CMD$ = "2" THEN CUSCOL = 2
820 IF CMD$ = "3" THEN CUSCOL = 3
830 IF CMD$ = "M" THEN OLDXX=XX:OLDYY=YY
840 IF CMD$ = "D" AND DDRAW = 0 THEN DDRAW = 1 : GOSUB 1170
850 IF ASC(CMD$) = 27 AND DDRAW THEN DDRAW=0 : PUT (0,0),STORARY%,PSET
860 IF CMD$ = "L" THEN GOSUB 1900
870 IF CMD$ = "P" THEN GOSUB 2000
880 IF CMD$ = "B" THEN GOSUB 2110
890 IF CMD$ = "E" THEN GOSUB 2350
900 IF CMD$ = "R" THEN GOSUB 2560
910 IF CMD$ = "C" THEN GOSUB 2260
920 IF CMD$ = "A" THEN GOSUB 2960
930 IF CMD$ = "U" THEN PUT (1,1),BEFPLEFT%,PSET : PUT (160,1),BEFPRIGHT%,PSET : BEFCOLOR = POINT(XX,YY)
940 IF CMD$ = "T" AND DDRAW = 0 THEN PSET (XX,YY),BEFCOLOR:GET (0,0)-(32,8), STORARY%
950 IF CMD$ = "T" THEN LOCATE 1,1:PRINT "Text";:LINE (32,0)-(32,8),BORDERCOL : LINE (0,8)-(32,8),BORDERCOL : TEXTMODEFLAG=1 : DDRAW=0:GOTO 610
960 IF CMD$ = "S" THEN KOPY=1:GOSUB 3230
970 IF CMD$ = "K" AND KOPY THEN GOSUB 3360
980 IF CMD$ = "X" THEN GOSUB 2060
990 IF CMD$ = "H" THEN GOSUB 1200
1000 IF CMD$ = "?" THEN ERASE STORARY%,BEFPLEFT%,BEFPRIGHT%,SAVEBLOCK%:GOTO 520
1010 'Adjust so pointer does not exceed borders.
1020 IF XX>318 THEN XX=318
1030 IF YY>198 THEN YY=198
1040 IF TEXTMODEFLAG=0 AND DDRAW=0 THEN 1070
1050 IF XX>=28 AND XX<=32 AND YY<9 THEN XX=33 : GOTO 1070
1060 IF YY=8 AND XX<33 THEN YY=9
1070 IF XX<1 THEN XX=1
1080 IF YY<1 THEN YY=1
1090 'If in draw mode leave current position as is. If not, restore dot.
1100 'Save color of this position.
1110 IF DDRAW THEN 1140
1120 PRESET(LASTXX,LASTYY),BEFCOLOR
1130 BEFCOLOR = POINT(XX,YY)
1140 PSET(XX,YY),CUSCOL
1150 LASTXX = XX : LASTYY = YY
1160 GOTO 610
1170 'Check if draw mode is on or not and display appropriate message.
1180 IF DDRAW THEN PSET(XX,YY),BEFCOLOR:GET (0,0)-(32,8),STORARY% : LOCATE 1,1 : PRINT "Draw"; : LINE (32,0)-(32,8),BORDERCOL : LINE (0,8)-(32,8),BORDERCOL
1190 RETURN
1200 ' Help menu display routine.
1210 PSET (XX,YY),BEFCOLOR
1220 ERASE SAVEBLOCK% : DIM SAVESCREEN%(8002)
1230 GET (0,0)-(319,199),SAVESCREEN%
1240 SCREEN 0,0,0 : WIDTH 80
1250 COLOR 7,1,1
1260 RESTORE:CLS:LOCATE 1,1,0:FOR I=1 TO 23:READ A$:PRINT A$:NEXT I
1270 READ A$ : PRINT A$;
1280 CMD$=INKEY$:IF CMD$="" THEN 1280
1290 IF ASC(CMD$)=27 AND PSTART%=1 THEN 510
1300 IF ASC(CMD$)=27 THEN 1360
1310 IF ASC(CMD$)<>32 THEN 1280
1320 CLS:LOCATE 1,1,0:FOR I=1 TO 23:READ A$:PRINT A$:NEXT I
1330 READ A$ : PRINT A$;
1340 CMD$=INKEY$:IF CMD$="" THEN 1340
1350 IF PSTART%=1 THEN 510
1360 CLS:SCREEN 1:COLOR BACKCOLOR,PALETTE
1370 PUT (0,0),SAVESCREEN%,PSET
1380 ERASE SAVESCREEN% : DIM SAVEBLOCK%(5) : KOPY = 0
1390 RETURN
1400 ' Data statements for help menus
1410 DATA " >>> INSTRUCTION SCREEN <<< Page 1"
1420 DATA " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE"
1430 DATA " OPENTo move the pinpoint, on side pad, press: OPEN"
1440 DATA " OPEN OPEN"
1450 DATA " OPEN 1, 2, 3, 4, 6, 7, 8, or 9. Ctrl-6, Ctrl-4, Ctrl-1, OPEN"
1460 DATA " OPEN or Ctrl-7 moves pinpoint increments of 5. OPEN"
1470 DATA " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD"
1480 DATA " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE"
1490 DATA " OPENColor control: OPEN"
1500 DATA " OPEN OPEN KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE"
1510 DATA " OPEN Border: 'B <0, 1, 2, or 3>', OPEN OPENCircles: OPEN"
1520 DATA " OPEN Background: 'BB <0 thru 15> B', OPEN OPEN OPEN"
1530 DATA " OPEN Palettes: '-' or '=', OPEN OPEN 'C <radius> C' - draws aOPEN"
1540 DATA " OPEN Pinpoint: '1', '2', '3', or '0'. OPEN OPEN circle with specifiedOPEN"
1550 DATA " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD OPEN radius. OPEN"
1560 DATA " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE OPEN 'CC' - draws a circleOPEN"
1570 DATA " OPENLines and Boxes: OPEN OPEN thru last marked po-OPEN"
1580 DATA " OPEN OPEN OPEN sition. OPEN"
1590 DATA " OPEN Use 'M' to set a marked position. OPEN SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD"
1600 DATA " OPEN 'LL' - draws a line from current position OPEN"
1610 DATA " OPEN to last marked position. OPEN Press 'space bar' for next"
1620 DATA " OPEN 'LB' - draws a box; corners are current OPEN page or <Esc> to exit Help."
1630 DATA " OPEN position to last marked postion. OPEN"
1640 DATA " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD"
1650 DATA " >>> INSTRUCTION SCREEN <<< Page 2"
1660 DATA ""
1670 DATA " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE"
1680 DATA " OPENCopying Blocks: OPEN OPENOther commands: OPEN"
1690 DATA " OPEN OPEN OPEN OPEN"
1700 DATA " OPEN 'S' - Saves in memory the box OPEN OPEN 'A' - Swaps current position OPEN"
1710 DATA " OPEN formed by the current OPEN OPEN with last marked position. OPEN"
1720 DATA " OPEN position and last marked OPEN OPEN 'E' - Exits the program. Saves OPEN"
1730 DATA " OPEN position. OPEN OPEN the graph if desired. OPEN"
1740 DATA " OPEN 'K' - Copies the last saved OPEN OPEN 'R' - Retrieves a graph saved on OPEN"
1750 DATA " OPEN box back onto the screen OPEN OPEN disk. Asks for filename. OPEN"
1760 DATA " OPEN in the new position of the OPEN OPEN 'P <1, 2, 3 or 0>' - Paints in OPEN"
1770 DATA " OPEN current 'pinpoint'. OPEN OPEN area bordered by specified OPEN"
1780 DATA " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD OPEN color. OPEN"
1790 DATA " OPEN 'D' - Puts program in DRAW mode. OPEN"
1800 DATA " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD"
1810 DATA " OPEN 'T' - Switches program into text mode. Allows any charact- OPEN"
1820 DATA " OPEN ers to be placed on screen; use 'ALT <ASC #>' for OPEN"
1830 DATA " OPEN characters not on keyboard. OPEN Press any key"
1840 DATA " OPEN 'U' - Restores graph to what it looked like before last OPEN when done."
1850 DATA " OPEN 'X', 'K' or 'P'. OPEN"
1860 DATA " OPEN 'X' - Saves entire screen in memory. OPEN"
1870 DATA " OPEN '?' - Clears screen and starts again with blank screen. OPEN"
1880 DATA " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD"
1890 ' LINES OR BOXES TAKEN HERE
1900 CMD$=INKEY$:IF CMD$="" THEN 1900
1910 IF CMD$="B" OR CMD$="b" THEN 1950
1920 IF CMD$<>"L" AND CMD$<>"l" THEN 1980
1930 LINE (XX,YY)-(OLDXX,OLDYY),CUSCOL
1940 GOTO 1960
1950 LINE (XX,YY)-(OLDXX,OLDYY),CUSCOL,B
1960 PSET (XX,YY),CUSCOL : BEFCOLOR = CUSCOL
1970 CMD$=""
1980 RETURN
1990 ' PAINTING DONE HERE
2000 CMD$=INKEY$:IF CMD$="" THEN 2000
2010 ' SAVE SCREEN BEFORE PAINTING IT.
2020 GOSUB 2060
2030 PAINT(XX,YY),CUSCOL,VAL(CMD$)
2040 BEFCOLOR = CUSCOL ' RETAIN CURRENT POSITIONS COLOR
2050 RETURN
2060 ' Option X - save screen.
2070 PRESET(LASTXX,LASTYY),BEFCOLOR
2080 GET (1,1)-(159,198),BEFPLEFT% : GET (160,1)-(318,198),BEFPRIGHT%
2090 PRESET(LASTXX,LASTYY),CUSCOL
2100 RETURN
2110 ' BORDER DRAWER
2120 CMD$=INKEY$:IF CMD$="" THEN 2120
2130 IF CMD$<>"B" AND CMD$<>"b" THEN 2220
2140 ' BACKGROUND COLOR
2150 CAT$ = ""
2160 CMD$=INKEY$:IF CMD$="" THEN 2160
2170 IF CMD$="B" OR CMD$="b" THEN 2200
2180 IF CMD$<"0" OR CMD$ >"9" THEN 2250
2190 CAT$=CAT$+CMD$:GOTO 2160
2200 BACKCOLOR=VAL(CAT$):COLOR BACKCOLOR,PALETTE
2210 GOTO 2250
2220 IF CMD$<>"0" AND CMD$<>"1" AND CMD$<>"2" AND CMD$<>"3" THEN GOTO 2250
2230 BORDERCOL = VAL(CMD$)
2240 LINE(0,0)-(319,199),BORDERCOL,B
2250 RETURN
2260 ' CIRCLE DRAWER
2270 CAT$ = ""
2280 CMD$=INKEY$:IF CMD$="" THEN 2280
2290 IF CMD$=>"0" AND CMD$<="9" THEN CAT$=CAT$+CMD$:GOTO 2280
2300 IF CMD$<>"C" AND CMD$<>"c" THEN 2340
2310 RAD#=(OLDXX-XX)^2+(OLDYY-YY)^2
2320 IF CAT$="" THEN CIRCLE (XX,YY),SQR(RAD#),CUSCOL : GOTO 2340
2330 CIRCLE (XX,YY),VAL(CAT$),CUSCOL
2340 RETURN
2350 ' SAVING/EXITING PROCESS
2360 GET (64,32)-(255,39),STORARY%
2370 LOCATE 5,9 : PRINT "Save graph (Y/N)? :"
2380 SROW=5:SCOL=27:MAX=1:GOSUB 3430:YNRES$=DAT$
2390 IF YNRES$="N" THEN GOSUB 2490 ELSE GOSUB 2920
2400 PRESET(LASTXX,LASTYY),BEFCOLOR
2410 IF SAVRES$>"A" AND SAVRES$<"Z" THEN GOTO 2460
2420 IF SAVRES$>"a" AND SAVRES$<"z" THEN GOTO 2460
2430 LOCATE 5,9 : PRINT " Graph not saved. "
2440 FOR WT = 1 TO 1000 : NEXT WT
2450 GOTO 2520
2460 DEF SEG = &HB800
2470 ON ERROR GOTO 2780:ERRLX%=5:ERRLY%=9
2480 BSAVE SAVRES$,0,&H4000
2490 LOCATE 5,9 : PRINT "Resume (Y/N)? :"
2500 SROW=5:SCOL=23:MAX=1:GOSUB 3430:YNRES$=DAT$
2510 IF YNRES$="N" THEN GOTO 3620
2520 PUT (64,32),STORARY%,PSET
2530 PRESET(LASTXX,LASTYY),CUSCOL
2540 RETURN
2550 ' RESTORE PROCESS
2560 PSET (XX,YY),BEFCOLOR
2570 ERASE SAVEBLOCK% : DIM SAVESCREEN%(8002)
2580 GET (0,0)-(319,199),SAVESCREEN%
2590 SCREEN 0,0,0 : WIDTH 80
2600 COLOR 3,0,0:PRINT "Files on disk are:":PRINT
2610 ON ERROR GOTO 2780 : ERRLX%=CSRLIN : ERRLY%=1
2620 FILES:PRINT
2630 PRINT "Enter filename to be restored (or just RETURN to cancel):"